@echo off
set gitlab_full_path=%1
set git_code_path=%2
set source_branch_name=%3
set target_branch_name=%4
cd /d %git_code_path%
if %errorlevel% equ 1 (
    echo cd %git_code_path% ERROR
    goto :exit
)
git init
git remote add origin %gitlab_full_path%
git fetch origin
git checkout -b %source_branch_name% origin/%source_branch_name%
git checkout -b %target_branch_name% origin/%target_branch_name%
git merge -s ours %source_branch_name% --allow-unrelated-histories
rem git merge %source_branch_name% --allow-unrelated-histories
rem git status > %git_code_path%\temp.txt
:exit
exit /b 0